﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.Security;

namespace OnlineReservation
{
    public partial class WebFormLogIn : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {

        }

        protected void ButtonCancel_Click(object sender, EventArgs e)
        {
            Response.Redirect("WebFormMain.aspx");
        }

        protected void ButtonLogIn_Click(object sender, EventArgs e)
        {
            if (Membership.ValidateUser(Server.HtmlEncode(Username.Text), Server.HtmlEncode(Password.Text)))
            {
                FormsAuthentication.RedirectFromLoginPage(Username.Text, false);
            }
            else
            {
                LabelError.Text = "Invalid login!";
            }
        }
    }
}